#include <iostream>
using namespace std;

int main()
{
    int q;
    int y, o, u;
    int minOne;
    cin >> q;

    while (q--)
    {
        cin >> y >> o >> u;
        minOne = min(y, min(o, u));
        cout << (o - minOne == 0 ? minOne * 2 : minOne * 2 + o - minOne - 1) << endl;
    }


    return 0;
}
